Page({
  data: {
    switchSex:false, // 假男性，真女性
    imageUrl:[
      '../../images/boy1.png',
      '../../images/boy2.png',
      '../../images/girl1.png',
      '../../images/girl2.png'
    ],
    showImage:'../../images/boy1.png',
    turnWatch:true, // 真正面，假反面
  },
  // 性别转换
  switchSexChange(){
    const that = this
    this.setData({
      switchSex:!that.data.switchSex
    })
    if(this.data.switchSex){
      this.setData({
        showImage:that.data.imageUrl[2]
      })
    }else{
      this.setData({
        showImage:that.data.imageUrl[0]
      })
    }
  },
  // 判断正反面
  turnFn(){
    const that = this
    if(this.data.turnWatch){
      if(this.data.switchSex){
        this.setData({
          showImage:that.data.imageUrl[3]
        })
      }else{
        this.setData({
          showImage:that.data.imageUrl[1]
        })
      }
      this.setData({
        turnWatch:!that.data.turnWatch
      })
    }else{
      if(this.data.switchSex){
        this.setData({
          showImage:that.data.imageUrl[2]
        })
      }else{
        this.setData({
          showImage:that.data.imageUrl[0]
        })
      }
      this.setData({
        turnWatch:!that.data.turnWatch
      })
    }
  },
  // 点击身体部位
  handlePart(data){
    let part = data.currentTarget.dataset.part
    wx.navigateTo({
      url: '/pages/part_keyword/part_keyword?part='+part
    })
  }
})